package cn.tedu.boot01.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class BMIController {
    @RequestMapping("/bmi")
    @ResponseBody
    public String bmi(Double height, Double weight) {
        System.out.println("height = " + height + ", weight = " + weight);
        double bmi = weight/(height*height);
        if (bmi<18.5){
            return "多吃点肉吧,太瘦了!";
        }
        if (bmi<24){
            return "身体杠杠滴!";
        }
        if (bmi<27){
            return "少吃点肉,有点胖了!";
        }
        return "你太胖了,该减肥了!!!";
    }
}
